export default (url) => {
  const crud = window.$crud(url);

  const getDrafts = (params) =>
    window.$axios({
      url: `${url}/drafts`,
      method: "get",
      params,
    });

  const getPageProjectId = (params) =>
    window.$axios({
      url: `${url}/page`,
      method: "get",
      params,
      meta: {
        hasProjectId: true,
      },
    });

  const addProjectId = (data) =>
    window.$axios({
      url: `${url}`,
      method: "post",
      data,
      meta: {
        hasProjectId: true,
      },
    });

  const request = (url, method, params, headers) =>
    window.$axios({
      url,
      method,
      params,
      data: params,
      headers,
      meta: {
        hasProjectId: true,
      },
    });

  return {
    ...crud,
    request,
    getDrafts,
    addProjectId,
    getPageProjectId,
  };
};
